#include <iostream>
#include <queue>
using namespace std;


int Fpow(int a,int n){
	if(n < 0)
		return -1;
	int ans=1;
	while(n){
		if(n & 1)
			ans = ans*a;
		a = a*a;
		n = n>>1;
	}
	return ans;
}


int main(){
	int n,n2;
	bool while_break=false;
	priority_queue<int> priq;
	queue<int> q;
	cin>>n;
	n2 = Fpow(2,n);
//	int a[n2];
	int ll;
	cin>>ll;
	q.push(ll);
	for(int i=1;i<n2;i++){
		int l;
		cin>>l;
		priq.push(l);
	}
	n2 = 1;
	while(!priq.empty()  &&  !while_break){
		for(int i=0;i<n2;i++){
			int l;
			l = q.front();
			q.pop();
			q.push(l);
			l--;
			if(priq.top() <= l){
				priq.pop();
				q.push(l);
			}
			else{
				while_break = true;
				break;
			}
		}
		n2 = n2*2;
	}
	if(priq.empty())
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}
